package com.fancon.android.gardenjokesx.rpc;

import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import android.content.Context;
import android.util.Log;

import com.fancon.android.gardenjokesx.entity.ReportErrors;
import com.fancon.android.gardenjokesx.utils.Constant;
import com.fancon.android.rpc.ApiConnect;
import com.fancon.android.rpc.FanconApiService;

public class GardenJokesApiService extends FanconApiService{
	public GardenJokesApiService(Context context, String apiRoot) {
		super(context, apiRoot);
		// TODO Auto-generated constructor stub
	}
	public GardenJokesApiService(Context context){
		super(context, Constant.XAD_ROOT);
	}
	public String resetPassword(String userName) throws NoSuchAlgorithmException, IOException{
		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
		nameValuePairs.add(new BasicNameValuePair("user", userName));
		ApiConnect api = new ApiConnect(mContext);
		String result = api.getApiData(this.apiRoot + "users/reset_password", nameValuePairs);
		Log.d("json", result);
		ReportErrors report;
		JsonPaser json = new JsonPaser();
		report = json.getReport(result);
		return report.getMessage();
	}
	
}
